package com.elastic.search.config;

import org.springframework.context.annotation.Configuration;

/**
 * @author: huangdeyao
 * @create: 2018-10-29 11:46
 **/
@Configuration
public class ElasticSearchConfig {

//    private TransportClient client = null;
//
//    private static final Settings settings = Settings.builder()
//            .put("cluster.name", "my-application-1")
//            .put("xpack.security.user", "elastic:123456")
//            //增加嗅探机制，找到ES集群 不是集群不能设置，否则会出问题
////            .put("client.transport.sniff", false)
//            //增加线程池个数为1
//            //.put("thread_pool.search.size", 5)
//            .build();
//
//    @Bean
//    public TransportClient client() throws UnknownHostException {
//        client = new PreBuiltXPackTransportClient(settings);
//        // transportClient = new PreBuiltTransportClient(esSetting);  不适用xpack加密时的用法
//        client.addTransportAddresses(new TransportAddress(InetAddress.getByName("192.168.177.128"), 9300));
////        client.addTransportAddresses(new TransportAddress(InetAddress.getByName("192.168.177.128"), 9300));
//
//        return client;
//    }
}
